const path = require('path');
const webpackMerge = require('webpack-merge');
const baseConfig = require('./webpack.base.config');
const fs = require('fs-extra');


const config = webpackMerge(baseConfig, {
    mode: "development",
    devtool: "source-map",
    devServer: {
        hot: true, // 热替换
        contentBase: path.join(__dirname, './dist'), // server文件的根目录
        compress: true, // 开启gzip
        port: 8083, // 端口
        proxy: {
            '/mock/': {
                target: 'http://localhost:3000/',
                pathRewrite: { '^/mock': '' },
                changeOrigin: true,     // target是域名的话，需要这个参数，
                secure: false,          // 设置支持https协议的代理
            }
        }
    }

});

fs.writeFile(path.join(__dirname, '../log/config/dev.json'), JSON.stringify(config, null, '\t'), function () { });


module.exports = config;